home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / c01oop.zip / ADAWKBK / SOL2-4.ADA < prev    next >
Text File  |  1992-08-25  |  613b  |  29 lines

  1. -- Problem 2.4
  2. -- by Rick Conn
  3. with Text_IO;
  4. procedure Main is
  5.  
  6.   type String_Rec is record
  7.     S : STRING(1..80);
  8.     L : NATURAL;  -- last index
  9.   end record;
  10.  
  11.   SRA : array (1..5) of String_Rec;
  12.  
  13. begin -- Main
  14.  
  15.   Text_IO.Put_Line ("Enter 5 strings:");
  16.  
  17.   for I in 1 .. 5 loop
  18.     Text_IO.Put ("String " & NATURAL'IMAGE(I) & ": ");
  19.     Text_IO.Get_Line (SRA(I).S, SRA(I).L);
  20.   end loop;
  21.  
  22.   for I in 1 .. 5 loop
  23.     Text_IO.Put ("Output String " & NATURAL'IMAGE(I) & ": ");
  24.     Text_IO.Put_Line (SRA(I).S (1 .. SRA(I).L));
  25.       -- output a slice of the string
  26.   end loop;
  27.  
  28. end Main;
  29.